<template>
    <div>
        <div class="card1" v-for="(item, index) in teacherList" :key="index" @click="toTeacher(item.teacher_id)">
            <img :src="item.teacher_avatar" alt="">
            <div>
                <p class="card-name">{{item.teacher_name}}</p>
                <p class="card-content">{{item.introduction}}</p>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props:["teacherList"],
        methods:{
            toTeacher(id){
                this.$emit("toTeacher",id)
            }
        }
    }
</script>

<style lang="scss" scoped>
.card1{
    width: 100%;
    height: 80px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-bottom: 10px;
    img{
        width: 40px;
        height: 40px;
        border-radius: 20px;
    }
    div{
        width: 80%;
        // background: pink;
        .card-name{
            font-size: 16px;
        }
        .card-content{
            font-size: 14px;
            color: rgb(150, 150, 150);
        }
        p{
            white-space:nowrap; 
            overflow:hidden; 
            text-overflow:ellipsis;
            margin-top: 5px;
        }
    }
}
</style>